/*
 *    This program is free software; you can redistribute it and/or modify
 *    it under the terms of the GNU General Public License as published by
 *    the Free Software Foundation; either version 3 of the License
 *    This program is distributed in the hope that it will be useful,
 *    but WITHOUT ANY WARRANTY; without even the implied warranty of
 *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *    GNU General Public License for more details.
 *    You should have received a copy of the GNU General Public License
 *    along with this program; if not, write to the Free Software Foundation,
 *    Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA
 */

package JET.MouseStuff.SpecialTasks;

import JET.StaticActions;
import JET.Centers.ControlCenter;
import JET.MouseStuff.Task;
import JET.SA.SA_Selection;
import JET.Scene;
import JET.physics.Mass;
import JET.physics.steering.Torque;
import java.util.ArrayList;

/**
 *
 * @author 057Ry
 */
public class SetTorquesSourceMassTask implements Task
{

    static final ControlCenter CC = ControlCenter.getInstance();
    ArrayList<Torque> torquesList;
    private Scene scene;

    public SetTorquesSourceMassTask(ArrayList<Torque> tList, Scene s) {
        torquesList = new ArrayList<Torque>(tList);
        scene = s;
    }

    public boolean needKeyConfirmationToProceed() {
        return false;
    }

    public int getKeyCode() {
        return -1;
    }

    public boolean canProceed() {
        return true;
    }

    public void execute()
    {
        Mass m = scene.EC.selectionGroup.getMassList().get(0);

        for(Torque t : torquesList)
            StaticActions.setTorqueCenterMass(t, m);

        SA_Selection.clearSelection(scene);
    }
}